<template xmlns="http://www.w3.org/1999/html">
  <div class="page-header-index-wide">
    <!--头部导航-->
    <a-row :gutter="24">
      <a-col>
        <a-carousel autoplay>
          <div v-for="(item,index) in iamges" :key="index">
            <h3 @click="tz(item.imglink)"><img :src="getImgView(item.imgurl)" style="width: 100%;height: 200px"/></h3>
          </div>
        </a-carousel>
      </a-col>
    </a-row>

    <!--流程中心、流程提醒-->
    <a-row :gutter="24">
      <a-col :span="16" :style="{ paddingRight:'-12px' }">
        <eoa-cms-my-process></eoa-cms-my-process>
      </a-col>
      <a-col :span="8">
        <!-- <eoa-cms-plan></eoa-cms-plan> -->
        <eoa-cms-news></eoa-cms-news>
      </a-col>
    </a-row>
    <!--我的申请、系统公告-->
    <a-row :gutter="24">
      <a-col :span="16" :style="{ paddingRight:'-12px' }">
        <eoa-doc-manage/>
      </a-col>
      <a-col :span="8">
        <eoa-cms-comm-use></eoa-cms-comm-use>
      </a-col>
    </a-row>
  </div>

</template>

<script>
import ACol from 'ant-design-vue/es/grid/Col'
import infiniteScroll from 'vue-infinite-scroll'
import BarMultid from '@/components/chart/BarMultid'
// import { formatDate } from '@/utils/util'
import EoaCmsMyProcess from './modules/process/EoaCmsMyProcess'
import EoaCmsPlan from './modules/plan/EoaCmsPlan'
import EoaCmsNews from './modules/information/EoaCmsNews'
import EoaCmsCommUse from './modules/entrance/EoaCmsCommUse'
import EoaDocManage from './modules/information/EoaDocManage'
// import { getAction } from '@/api/manage'
import { getFileAccessHttpUrl, httpAction } from '@/api/manage'

export default {
  name: 'Workbench',
  directives: { infiniteScroll },
  components: {
    ACol,
    BarMultid,
    EoaCmsMyProcess,
    EoaCmsPlan,
    EoaCmsNews,
    EoaCmsCommUse,
    EoaDocManage
  },
  data () {
    return {
      loading: true,
      url: {
        queryPortalSite: '/api/erpmng/eoa/cms/eoaPortalSite/queryPortal',
        queryImages: 'api/erp/api/erpSlideshow/queryImages?suitability=1'
      },
      iamges: []
    }
  },
  beforeRouteLeave (to, from, next) {
    this.$destroy()
    next()
  },
  created() {
    // 通告和日程计划
    // this.initNoticePlanEmailInfo();
    setTimeout(() => {
      this.loading = !this.loading
    }, 1000)
    const that = this;
    httpAction(this.url.queryImages, null, 'get').then((res) => {
      if (res.success) {
          this.iamges = res.result;
      } else {
        that.$message.warning(res.message);
      }
    }).finally(() => {
      that.confirmLoading = false;
    })
  },
  methods: {
    getFormData(module) {
      return this[module.formData]
    },
    getImgView(text) {
      if (text && text.indexOf(',') > 0) {
        text = text.substring(0, text.indexOf(','))
      }
      return getFileAccessHttpUrl(text)
    },
    tz(res) {
      // 如果存在链接再操作
      if (res) {
        // erp内部链接
        if (res.slice(0, 1) == '/') {
          this.$router.push({ path: res })
        } else {
          // 其他网站跳转
          window.open(res, '_blank');
        }
      }
    }
  }
}
</script>

<style lang="less" scoped>
  /deep/ .ant-carousel .slick-slide {
    text-align: center;
    height: 200px;
    background: #364d79;
    overflow: hidden;
  }

  .ant-list-item-meta-title {
   font-weight: 600;
  }
  .demo-infinite-container {
    border: 1px solid #e8e8e8;
    overflow: auto;
    /*padding: 8px 24px;*/
    overflow: auto;
    height: 95px;
  }
  .demo-loading-container {
    position: absolute;
    bottom: 40px;
    width: 100%;
    text-align: center;
  }
  .timespan{
    background: #F5F5F5;
    width: 100px;
    height: 30px;
    line-height: 30px;
    text-align: center;
  }
  .demo-infinite-container .ant-list-item {
    padding: 0px 0;
  }
  .headicon{
    display:flex;
    flex-direction: column;
    align-items: center;
    border:0
}
  .header1{
    width: 100%;
    text-align: center;
    display: flex;
    background-color: white;
    border-bottom: 1px solid #e7eaec;
    height: 42px;
    border-top: 1px solid #e7eaec;
    margin-top: 10px;
  }
 /* a{
    color: black;
    text-align: center;
  }*/
  .full-calendar{
    margin: 0 30px 0 30px !important;
  }
  /deep/ .fc-center{
    font-size: x-small;
  }
  /deep/  .fc-button-primary {
    background-color: #1890FF !important;
    border-color: #1890FF !important;
  }
</style>
